package cadc.ping;


import cadc.actions.UserAction;

import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

@SuppressWarnings("serial")
public class UserUnLoggedinInterceptor extends AbstractInterceptor {

	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		UserAction  action = (UserAction)invocation.getAction();
		if(action.getAccount().isLoggedin()){
			action.addActionError("登录状态不能发送此请求");
			return "error";
		}else{
			return invocation.invoke();
		}
	}

}
